package com.dou.you.che.web.queue.hander;

import com.dou.you.che.cache.constants.RedisConstant;
import com.dou.you.che.cache.queue.hander.MessageHandler;
import com.dou.you.che.core.entity.sys.SysLog;
import com.dou.you.che.service.sys.SysLogServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 日志监听器
 * @Author 黄国刚【1058118328@qq.com】
 */
@Component
public class LogHandler extends MessageHandler<SysLog> {

    @Autowired
    private SysLogServiceI sysLogService;

    /**
     * 初始化
     */
    public LogHandler(){
        super(RedisConstant.XeeSysLog, SysLog.class, 10);
    }

    /**
     * 监听处理
     * @param monitorLog
     */
    @Override
    public void handle(SysLog monitorLog) {

        sysLogService.save(monitorLog);
    }

    /**
     * 监听失败处理
     * @param obj
     */
    @Override
    public void handleFailed(SysLog obj) {

    }
}
